<template>
	<a-modal title="选择发货人" :centered="true" :footer="null" :maskClosable="false" :width=900 v-model="show" @ok="handleOk">
	</a-modal>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				type:'',
				data:[],
				columns,
				show: false,
				loading: false,
			}
		},
		computed: {},
		created: function() {},
		methods: {
			// 获取联系人信息
			getPersonndlList(type) {
				this.loading = true
				var params = {}
				params.pageSize = this.pagination.defaultPageSize
				params.pageNum = this.pagination.defaultCurrent
				params.type = type
				params.userId = this.user.userId
				this.$get('/info/infoLinkman', params).then((r) => {
					console.log('联系人信息：', r)
					let d = r.data.data.rows
					this.data = []
					if(type == 1){
						for(var i in d){
							this.data.push({
								name:d[i].receivePersion,
								Telephone:d[i].receivePersonMobile,
								id:d[i].linkmanId
							})
						}
					}else{
						for(var i in d){
							this.data.push({
								name:d[i].sendPerson,
								Telephone:d[i].sendPersonMobile,
								id:d[i].linkmanId
							})
						}
					}
					this.loading = false
				}).catch((e)=>{
					console.log(e)
					this.loading = false
				})
			},
			// 表格排序 分页 筛选事件
			handleTableChange(pagination, filters, sorter) {
				// this.getcarSource({
				//   ...this.queryParams
				// })
			},
			// 选择传值
			Choice(data) {
				this.$emit('PersonnelData', data ,this.type);
				this.show = false
			},
			// 获取type 查询列表  
    		// type = 0  发货人
    		// type = 1  收货人
			openDialog(type) {
				console.log(type)
				this.type = type
				this.getPersonndlList(type)
				this.show = true
			},
			handleOk(d) {
				this.$emit('change')
			},

		},
		computed: {
			...mapState({
				multipage: state => state.setting.multipage,
				user: state => state.account.user,
			}),
		},
	}
</script>
<style lang="less">
</style>